﻿namespace Sage.Encryption
{
    /// <summary>
    /// 定义加密服务接口，提供基本的加密和解密功能
    /// </summary>
    public interface IEncryptionService
    {
        /// <summary>
        /// 加密字符串数据
        /// </summary>
        /// <param name="plainText">要加密的明文字符串</param>
        /// <returns>加密后的字节数组</returns>
        byte[] Encrypt(string plainText);

        /// <summary>
        /// 加密字节数组数据
        /// </summary>
        /// <param name="plainBytes">要加密的明文字节数组</param>
        /// <returns>加密后的字节数组</returns>
        byte[] Encrypt(byte[] plainBytes);

        /// <summary>
        /// 异步加密字节数组
        /// </summary>
        /// <param name="plainBytes">要加密的明文字节数组</param>
        /// <returns>加密后的字节数组任务</returns>
        Task<byte[]> EncryptAsync(byte[] plainBytes);

        /// <summary>
        /// 解密为字符串
        /// </summary>
        /// <param name="cipherBytes">加密的字节数组</param>
        /// <returns>解密后的字符串</returns>
        string DecryptToString(byte[] cipherBytes);

        /// <summary>
        /// 解密字节数组
        /// </summary>
        /// <param name="cipherBytes">加密的字节数组</param>
        /// <returns>解密后的字节数组</returns>
        byte[] Decrypt(byte[] cipherBytes);

        /// <summary>
        /// 异步解密字节数组
        /// </summary>
        /// <param name="cipherBytes">加密的字节数组</param>
        /// <returns>解密后的字节数组任务</returns>
        Task<byte[]> DecryptAsync(byte[] cipherBytes);
    }


}
